package cn.edu.cug.cs.gtl.apis.ui.model3duis;

import cn.edu.cug.cs.gtl.apis.render.Render;
import cn.edu.cug.cs.gtl.apis.render.viewers.Viewer;
import cn.edu.cug.cs.gtl.apis.ui.AbstractApplication;
import cn.edu.cug.cs.gtl.apis.ui.modeller.ModellerApp;
import cn.edu.cug.cs.gtl.protos.Layer;
import cn.edu.cug.cs.gtl.protos.Project;
import cn.edu.cug.cs.gtl.protos.Table;


import java.awt.*;

public class TablePanel extends cn.edu.cug.cs.gtl.apis.ui.table.TablePanel {
    protected AbstractApplication theApp = null;

    public TablePanel(AbstractApplication theApp,LayoutManager layout, boolean isDoubleBuffered) {
        super(layout,isDoubleBuffered);

        this.theApp=theApp;
    }

    public TablePanel(AbstractApplication theApp,LayoutManager layout) {
        super(layout);
        this.theApp=theApp;
    }

    public TablePanel(AbstractApplication theApp,boolean isDoubleBuffered) {
        super(isDoubleBuffered);
        this.theApp=theApp;
    }

    public TablePanel(AbstractApplication theApp) {
        super();
        this.theApp=theApp;
    }

    public void initial(){
        Layer curLayer = getModel3dUIApp().getCurrentLayer();
        Table table =null;
        if(curLayer != null )
            table=getModel3dUIApp().getCurrentLayer().getAttributeTable();
        initial(table);
    }

    public void reset(){
        Layer curLayer = getModel3dUIApp().getCurrentLayer();
        Table table =null;
        if(curLayer != null )
            table=getModel3dUIApp().getCurrentLayer().getAttributeTable();
        reset(table);
    }



    public Render getRender() {
        return ((ModellerApp)theApp).getModel3dUIApp().getRender();
    }

    public Viewer getViewer(){
        return ((ModellerApp)theApp).getModel3dUIApp().getViewer();
    }

    public Model3dUIApp getModel3dUIApp(){
        return ((ModellerApp)theApp).getModel3dUIApp();
    }

    public Project getProject() {
        return ((ModellerApp)theApp).getModel3dUIApp().getProject();
    }
}
